package com.cyl.game.demos.web.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Delete;
import com.cyl.game.demos.web.entity.UserHeroRelation;
@Mapper
public interface UserHeroRelationMapper {
    // 插入一条用户与英雄的关联记录
    @Insert("INSERT INTO user_hero_relation (user_id, hero_id) VALUES (#{user_id}, #{hero_id})")
    int insertUserHeroRelation(UserHeroRelation relation);

    // 根据关联记录的ID删除关联记录（可用于解除用户与英雄的拥有关系等场景）
    @Delete("DELETE FROM user_hero_relation WHERE relation_id = #{relation_id}")
    int deleteUserHeroRelationById(int relation_id);
        // 根据用户 ID 和英雄 ID 查询对应的关联记录，使用注解方式写 SQL 语句
    //@Select("SELECT * FROM user_hero_relation WHERE user_id = #{user_id} AND hero_id = #{hero_id}")
    UserHeroRelation selectRelationByUserIdAndHeroId(int user_id, int hero_id);
}